import React, { Component, createRef,createContext, useRef ,useState} from "react";
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
//  react 跨多级组件传递参数
const {Provider,Consumer}  = createContext({})

const DemoA = () => {
  return (
    <>
     <div> this is DemoA</div>
      <DemoB />
    </>
  );
};

const DemoB = () => {
  let [valu111,setValue11] = useState<any>(0)
  let pointer:any = useRef().current; //二维向量
  console.log(valu111,' daying yixia ')
  return (
    <>this is DemoB

    <div> 这个是上面传递过来的数据：{valu111}
    <div>-------------------</div>
    {pointer}
    <Consumer>
       

       { (value):any=>pointer=value
       
       
       }
   </Consumer>
    </div>
 
    
    </>
  );
};
class ReactDemo extends React.Component {
  state: any = {
    count: '120391203910239210392103',
  };

  render(): React.ReactNode {
    return (
      <Provider value={this.state.count}>
      <div>
      嘻嘻嘻
      </div>
       
        <DemoA />
      </Provider>
    );
  }
}

export default ReactDemo;
